<?
class Square
{
	public $x;
	public $y;
	public $terrain_type;
	public $has_tower;
	
	public function __construct() {
        $this->hast_tower = false;
        $this->terrain_type = new TerrainType();
    }
	
	public function is_playable() {
		if ($this->has_tower) {
			return false;
		}
		if ($this->is_wall()) { return false; }
		return true;
	}
	
	public function is_wall() {
		global $colCount, $rowCount;
		if ($this->x == 0 || $this->x == $rowCount-1) {
			return true;
		}
		if ($this->y == $colCount-1 || $this->y == 0) {
			return true;
		}
		return false;
	}
};
class TerrainType {
	public $name;
	public $image;
	
	public function __construct($name = "Grassland", $image = "grass.png") {
		$this->name = $name;
		$this->image = $image;
	}
	}
?>